package com.qf.service.impl;

import com.qf.entity.TFilters;
import com.qf.events.TfiltersEvent;
import com.qf.mapper.FiltersMapper;
import com.qf.service.FiltersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/*
杨威
2021/11/6
15:40
*/
@Service
@Transactional
public class FiltersServiceImpl implements FiltersService {
    @Autowired
    FiltersMapper filtersMapper;
    @Autowired
    ApplicationContext context;
    @Override
    public int add(TFilters tFilters) {
        int add = filtersMapper.add(tFilters);
        context.publishEvent(TfiltersEvent.class);
        return add;
    }

    @Override
    public int delete(Long id) {
        int delete = filtersMapper.delete(id);
        context.publishEvent(TfiltersEvent.class);
        return delete;
    }

    @Override
    public int update(TFilters tFilters) {
        int update = filtersMapper.update(tFilters);
        context.publishEvent(TfiltersEvent.class);
        return update;
    }
}
